package com.secf.service.port.hpy.hys.test.day3;

import java.util.Arrays;

/**
 * @Author ms
 * @Date 2024-08-08
 */
public class StudentScores {
    public static void main(String[] args) {
        int[] scores = {85, 78, 92, 67, 88, 79, 91};

        // 对成绩进行排序
        Arrays.sort(scores);

        // 查找最高分和最低分
        int highest = scores[scores.length - 1];
        int lowest = scores[0];

        // 计算平均分
        int sum = 0;
        for (int score : scores) {
            sum += score;
        }
        double average = sum / (double) scores.length;

        System.out.println("所有成绩: " + Arrays.toString(scores));
        System.out.println("最高分: " + highest);
        System.out.println("最低分: " + lowest);
        System.out.println("平均分: " + average);
    }
}
